
<!doctype html>
<html lang="zh-CN">
<head>
    <!-- 必须的 meta 标签 -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- Bootstrap 的 CSS 文件 -->
    <link rel="stylesheet" href="bootstrap-4.6.0-dist/css/bootstrap.min.css" />
    <script src="scripts/jquery-3.6.0.min.js"></script>
    <script src="bootstrap-4.6.0-dist/js/bootstrap.bundle.min.js"></script>
    <title>快速启动</title>
</head>

<body>
    <ul class="nav nav-tabs">
        <li class="nav-item">
            <a href="dashboard" class="nav-link">仪表板</a>
        </li>
        <li class="nav-item">
            <a href="quikly" class="nav-link active">快速启动</a>
        </li>
        <li class="nav-item">
            <a href="cgasettings" class="nav-link">CGA软件设置</a>
        </li>
        <!--<li class="nav-item">
            <a href="accounts" class="nav-link">账号管理</a>
        </li>
        <li class="nav-item">
            <a href="characters" class="nav-link">游戏角色管理</a>
        </li>-->
    </ul>
    <div class="tab-content">
        <div class="tab-pane fade show active" id="quikly" role="tabpanel">
<div class="container-fluid">
    <h3 style="margin-top: 8px;">可启动角色列表</h3>
    <table class="">
        <tr>
            <td><a class="btn btn-primary">快速添加角色</a></td>
            <td>
                <div class="input-group dropdown">
                    <input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" placeholder="Username" />
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                    </div>
                    <div class="input-group-append">
                        <button type="button" class="btn btn-info">123</button>
                    </div>
                </div>
            </td>
            <td>
                <div class="dropdown">
                    <input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" value="Dropdown button" />
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                        <a class="dropdown-item" href="#">Something else here</a>
                    </div>
                </div>

            </td>
            <td>
                <div class="dropdown">
                    <input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" value="" />
                    <select class="form-control dropdown-menu" size="10" onclick="$(this).prev().val(this.value);">
                        <option value="Action 2">Action 2</option>
                        <option value="Action 4">Action 4</option>
                        <option value="Action 6">Action 6</option>
                        <option value="Action 7 6 5 4 3 2 1">Action 7 6 5 4 3 2 1</option>
                    </select>
                </div>

            </td>
        </tr>
    </table>

    <hr />
    <table class="table table-hover table-sm">
    <thead>
    <tr>
      <th scope="col">角色</th>
      <th scope="col">左右</th>
      <th scope="col">服务器</th>
      <th scope="col">线路</th>
      <th scope="col">自动登录</th>
      <th scope="col">跳过更新</th>
      <th scope="col">自动换线</th>
      <th scope="col">脚本自动重启</th>
      <th scope="col">受伤保护</th>
      <th scope="col">掉魂保护</th>
      <th scope="col">加载脚本</th>
      <th scope="col">加载设置</th>
      <th scope="col">操作</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>
            存在之因
            <input type="hidden" id="chara1-gid_name" value="zthitemmoli" />
            <input type="hidden" id="chara1-account_name" value="zthitemmoli" />
        </td>
        <td><select class="form-control form-control-sm" id="chara1-chara_lr">
            <option value="1" selected>左</option>
            <option value="2">右</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara1-server_id">
            <option value="4" selected>道具电信</option>
            <option value="40">道具网通</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara1-server_line">
            <option value="1">1线</option>
            <option value="2" selected>2线</option>
            <option value="3">3线</option>
            <option value="4">4线</option>
            <option value="5">5线</option>
            <option value="6">6线</option>
            <option value="7">7线</option>
            <option value="8">8线</option>
            <option value="9">9线</option>
            <option value="10">10线</option>
        </select></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-autologin" checked /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-skipupdate" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-autochangeserver" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-scriptautorestart" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-injuryprotect" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara1-soulprotect" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara1-loadscript" value="" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara1-loadsettings" value="" /></td>
        <td>
            <button class="btn btn-info btn-sm" onclick="onSave(1);">保存</button>
            <button class="btn btn-success btn-sm" onclick="onStartup(1);">启动</button>
        </td>
    </tr>
    <tr>
        <td>
            佐佐人起手式
            <input type="hidden" id="chara2-gid_name" value="zthitemmoli" />
            <input type="hidden" id="chara2-account_name" value="zthitemmoli" />
        </td>
        <td><select class="form-control form-control-sm" id="chara2-chara_lr">
            <option value="1" selected>左</option>
            <option value="2">右</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara2-server_id">
            <option value="4">道具电信</option>
            <option value="40" selected>道具网通</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara2-server_line">
            <option value="1">1线</option>
            <option value="2">2线</option>
            <option value="3" selected>3线</option>
            <option value="4">4线</option>
            <option value="5">5线</option>
            <option value="6">6线</option>
            <option value="7">7线</option>
            <option value="8">8线</option>
            <option value="9">9线</option>
            <option value="10">10线</option>
        </select></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-autologin" checked /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-skipupdate" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-autochangeserver" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-scriptautorestart" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-injuryprotect" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara2-soulprotect" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara2-loadscript" value="" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara2-loadsettings" value="" /></td>
        <td>
            <button class="btn btn-info btn-sm" onclick="onSave(2);">保存</button>
            <button class="btn btn-success btn-sm" onclick="onStartup(2);">启动</button>
        </td>
    </tr>
    <tr>
        <td>
            水水人心的距离
            <input type="hidden" id="chara3-gid_name" value="zthitemmoli01" />
            <input type="hidden" id="chara3-account_name" value="zthitemmoli" />
        </td>
        <td><select class="form-control form-control-sm" id="chara3-chara_lr">
            <option value="1" selected>左</option>
            <option value="2">右</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara3-server_id">
            <option value="4">道具电信</option>
            <option value="40" selected>道具网通</option>
        </select></td>
        <td><select class="form-control form-control-sm" id="chara3-server_line">
            <option value="1" selected>1线</option>
            <option value="2">2线</option>
            <option value="3">3线</option>
            <option value="4">4线</option>
            <option value="5">5线</option>
            <option value="6">6线</option>
            <option value="7">7线</option>
            <option value="8">8线</option>
            <option value="9">9线</option>
            <option value="10">10线</option>
        </select></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-autologin" checked /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-skipupdate" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-autochangeserver" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-scriptautorestart" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-injuryprotect" /></td>
        <td><input type="checkbox" class="form-control form-control-sm" id="chara3-soulprotect" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara3-loadscript" value="" /></td>
        <td><input type="text" class="form-control form-control-sm" id="chara3-loadsettings" value="" /></td>
        <td>
            <button class="btn btn-info btn-sm" onclick="onSave(3);">保存</button>
            <button class="btn btn-success btn-sm" onclick="onStartup(3);">启动</button>
        </td>
    </tr>
    </tbody>
    </table>
    <script>
        function getChara(id) {
            var chara = {
                chara_id: id,
                chara_lr: $('#chara'+id+'-chara_lr').val(),
                gid_name: $('#chara'+id+'-gid_name').val(),
                server_id: $('#chara'+id+'-server_id').val(),
                account_name: $('#chara'+id+'-account_name').val(),
                server_line: $('#chara'+id+'-server_line').val(),
                autologin: $('#chara'+id+'-autologin')[0].checked+0,
                skipupdate: $('#chara'+id+'-skipupdate')[0].checked+0,
                autochangeserver: $('#chara'+id+'-autochangeserver')[0].checked+0,
                scriptautorestart: $('#chara'+id+'-scriptautorestart')[0].checked+0,
                injuryprotect: $('#chara'+id+'-injuryprotect')[0].checked+0,
                soulprotect: $('#chara'+id+'-soulprotect')[0].checked+0,
                loadscript: $('#chara'+id+'-loadscript').val(),
                loadsettings: $('#chara'+id+'-loadsettings').val(),
            };
            return chara;
        }
        function onSave(id) {
            $.ajax( {
                url: 'action/quiklysave',
                data: { 'chara': JSON.stringify( getChara(id) ) },
                dataType: 'json',
                success: function(data) {
                    console.log(data);
                    //console.log( eval('('+data+')') );
                }
            } );
        }
        function onStartup(id) {
            $.ajax( {
                url: 'action/startupgame',
                data: { 'chara': JSON.stringify( getChara(id) ) },
                dataType: 'json',
                success: function(data) {
                    console.log(data);
                    //console.log( eval('('+data+')') );
                }
            } );
        }
    </script>
</div>
        </div>
    </div>

</body>

</html>
